package com.company.test.proxy;

import java.lang.reflect.Method;

/**
 * @author zhangyan
 * @version $ Id: ProxyDemo.java, v 0.1 2020/9/15 19:47 zhangyan Exp $
 */
public class ProxyDemo {
    public static void main(String[] args) throws Exception{
        // 保存生成的代理类的字节码文件
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
        MapperProxyFactory<UserMapper> factory = new MapperProxyFactory(UserMapper.class);
        UserMapper userMapper = factory.newInstance(new MapperProxy<>(UserMapper.class));
        String aaa = userMapper.getName("aaa");
        System.out.println(aaa);
    }
}
